package com.xbongbong.workflow.domain.entity.ext;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.ext.PaasAttachmentEntityExt;
import com.xbongbong.workflow.domain.entity.WorkflowCommentEntity;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: wufeng
 * @date: 2018/8/29 10:14
 * @desrcption:
 */
@Setter
@Getter
public class WorkflowCommentEntityExt extends WorkflowCommentEntity {
    
    private static final long serialVersionUID = 8165447411521636221L;
    /**
     * 图片
     */
    private List<String> imageList;

    /**
     * 文件
     */
    private List<PaasAttachmentEntityExt> attachmentList;

    /**
     * atUserId list
     */
    private JSONArray atUserIdList;

    /**
     * 操作权限
     */
    private JSONArray permissionSet;

    public List<String> getImageList() {
        return imageList;
    }

    public void setImageList(String image) {
        this.imageList = JSONArray.parseArray(image, String.class);
    }

    public List<PaasAttachmentEntityExt> getAttachmentList() {
        return attachmentList;
    }

    public void setAttachmentList(String attachment) {
        List<String> attachmentStrList = JSONArray.parseArray(attachment, String.class);
        List<PaasAttachmentEntityExt> attachments = new ArrayList<>();
        attachmentStrList.forEach((attachmentItem)->{
            PaasAttachmentEntityExt paasAttachmentEntityExt = JSONObject.parseObject(attachmentItem, PaasAttachmentEntityExt.class);
            attachments.add(paasAttachmentEntityExt);
        });
        this.attachmentList = attachments;
    }

    private String addTimeStr;

}
